<?php 
	
		if(isset($_POST['upload'])){
		
		  $upload_dir = "C:\\";
		  $temp_name = $_FILES['userfile']['tmp_name']; 
		  
		  $file_name = $_FILES['userfile']['name'];  
		  
		  $file_name = str_replace("\\","",$file_name); 
		  
		  $file_name = str_replace("'","",$file_name); 
		  echo   $file_name;
		  $file_path = $upload_dir.$file_name; 
		
		    //File Name Check 
		  if ( $file_name =="") {  
		      $message = "Invalid File Name Specified"; 
		      return $message; 
		  } 
		
		  $result  =  move_uploaded_file($temp_name, $file_path); 
		  if (!chmod($file_path,0777)) 
		       $message = "change permission to 777 failed."; 
		  else 
		    $message = ($result)?"$file_name uploaded successfully." : 
		               "Somthing is wrong with uploading a file."; 
		  
		  echo $message;
		}
		
?> 

<center> 
  
   <br> 
   	<form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post" action="?"> 
     	Upload File <input type="file" id="userfile" name="userfile"> 
     	<input type="submit" name="upload" value="Upload"> 
    </form> 
    
  
  
</center>